package com.crt.openapi.modules.apiinterface.dao.impl;

import java.util.List;

import org.springframework.stereotype.Repository;

import com.crt.openapi.common.BaseDaoImpl;
import com.crt.openapi.modules.apiinterface.dao.ApiInterfaceInfDao;
import com.crt.openapi.modules.apiinterface.dao.vo.ApiPubInterfaceInf;
import com.crt.openapi.modules.apiinterface.dao.vo.KeyInt;
import com.crt.openapi.modules.common.domain.entity.ApiInterface;

/**
 * 
 * 
 * @Author zhaoqinli
 * @Version 2.0
 * @Date 2016年9月26日
 *
 */
@Repository("apiInterfaceInfDao")
public class ApiInterfaceInfDaoImpl extends BaseDaoImpl<ApiInterface> implements ApiInterfaceInfDao {

	public ApiInterfaceInfDaoImpl() {
		super();
		mapperName = "ApiInterfaceInfMapper";
	}

	@Override
	public List<ApiInterface> selectListByPage(int pageIndex, int pageSize, ApiInterface apiInterface) {
		//return getSqlSession().selectList("com.crt.openapi.modules.common.domain.mapper.ApiUserMapper" + ".selectOneByEntity",
		return getSqlSession().selectList("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectListByPage",
				apiInterface,makeRowBounds(pageIndex,pageSize));
	}

	@Override
	public int selectCountByPage(ApiInterface apiInterface) {
		apiInterface.setDelFlag(null);
		return getSqlSession().selectOne("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectCountByPage", apiInterface);
	}

	@Override
	public List<ApiPubInterfaceInf> selectPubListByPage(int pageIndex,
			int pageSize, ApiPubInterfaceInf apiPubInterface) {
		return getSqlSession().selectList("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectPubListByPage",
				apiPubInterface, makeRowBounds(pageIndex,pageSize));
	}

	@Override
	public int selectPubCountByPage(ApiPubInterfaceInf apiPubInterface) {
		return getSqlSession().selectOne("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectPubCountByPage", apiPubInterface);
	}

	@Override
	public int insertIgnoreSelective(ApiInterface record) {
		return getSqlSession().insert("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".insertIgnoreSelective", record);
	}

	@Override
	public ApiInterface selectByApiId(String apiId) {
		return getSqlSession().selectOne("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectByApiId", apiId);
	}

	@Override
	public List<ApiPubInterfaceInf> selectAllowSubListByPage(int pageIndex,
			int pageSize, ApiPubInterfaceInf record) {
		return getSqlSession().selectList("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectAllowSubListByPage",
				record,makeRowBounds(pageIndex,pageSize));
	}

	@Override
	public int selectAllowSubCountByPage(ApiPubInterfaceInf record) {
		return getSqlSession().selectOne("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectAllowSubCountByPage", record);
	}

	@Override
	public int updateByApiIdSelective(ApiInterface record) {
		return getSqlSession().update("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".updateByApiIdSelective", record);
	}

	@Override
	public ApiPubInterfaceInf selectApiPubInterfaceInfByApiId(String apiId) {
		return getSqlSession().selectOne("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectApiPubInterfaceInfByApiId", apiId);
	}
	
	@Override
	public List<ApiPubInterfaceInf> selectAllApiInterface(ApiPubInterfaceInf apiPubInterfaceInf){
		return getSqlSession().selectList("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectPubListByApp",apiPubInterfaceInf);
	}

	@Override
	public ApiPubInterfaceInf selectAllApiPubInterface(int id) {
		return getSqlSession().selectOne("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectAllApiPubInterface",id);
	}

	@Override
	public ApiInterface uniqueApi(String apiId) {
		// TODO Auto-generated method stub
		return getSqlSession().selectOne("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".uniqueApi",apiId);
	}
	
	@Override
	public List<ApiPubInterfaceInf> selectPubListByApp(int pageIndex,
			int pageSize,ApiPubInterfaceInf apiPubInterfaceInf){
		return getSqlSession().selectList("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectPubListByApp",
				apiPubInterfaceInf,makeRowBounds(pageIndex,pageSize));
	}
	
	@Override
	public int selectPubCountByApp(ApiPubInterfaceInf apiPubInterfaceInf){
		return getSqlSession().selectOne("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectPubCountByApp", apiPubInterfaceInf);
	}
	
	@Override
	public List<ApiPubInterfaceInf> selectPubListInfo(ApiPubInterfaceInf inf){
		return getSqlSession().selectList("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectPubListInfo",inf);
	}
	
	@Override
	public List<KeyInt>  selectPubApiCntBySysIds(List<String> sysIds){
		return getSqlSession().selectList("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectPubApiCntBySysIds",
				sysIds);
	}
	
	@Override
	public List<KeyInt> selectPubApiCntByAppIds(List<String> appIds){
		return getSqlSession().selectList("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectPubApiCntByAppIds",
				appIds);
	}

	@Override
	public List<ApiPubInterfaceInf> selectInfListExtra(ApiPubInterfaceInf inf) {
		return getSqlSession().selectList("com.crt.openapi.modules.apiinterface.dao.impl." + mapperName + ".selectInfListExtra",inf);
	}
}